package com.ruoyi.slope.warning.threshold.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.slope.warning.threshold.mapper.SlopeWarningThresholdMapper;
import com.ruoyi.slope.warning.threshold.domain.SlopeWarningThreshold;
import com.ruoyi.slope.warning.threshold.service.ISlopeWarningThresholdService;

/**
 * 预警阈值Service业务层处理
 * 
 * @author psy
 * @date 2025-04-27
 */
@Service
public class SlopeWarningThresholdServiceImpl implements ISlopeWarningThresholdService 
{
    @Autowired
    private SlopeWarningThresholdMapper slopeWarningThresholdMapper;

    /**
     * 查询预警阈值
     * 
     * @param id 预警阈值主键
     * @return 预警阈值
     */
    @Override
    public SlopeWarningThreshold selectSlopeWarningThresholdById(Long id)
    {
        return slopeWarningThresholdMapper.selectSlopeWarningThresholdById(id);
    }

    /**
     * 查询预警阈值列表
     * 
     * @param slopeWarningThreshold 预警阈值
     * @return 预警阈值
     */
    @DataScope(deptAlias = "s")
    @Override
    public List<SlopeWarningThreshold> selectSlopeWarningThresholdList(SlopeWarningThreshold slopeWarningThreshold)
    {
        return slopeWarningThresholdMapper.selectSlopeWarningThresholdList(slopeWarningThreshold);
    }

    /**
     * 告警任务查询预警阈值列表
     *
     * @param slopeWarningThreshold 预警阈值
     * @return 预警阈值
     */
    public List<SlopeWarningThreshold> alarmSelectSlopeWarningThresholdList(SlopeWarningThreshold slopeWarningThreshold)
    {
        return slopeWarningThresholdMapper.selectSlopeWarningThresholdList(slopeWarningThreshold);
    }

    /**
     * 新增预警阈值
     * 
     * @param slopeWarningThreshold 预警阈值
     * @return 结果
     */
    @Override
    public int insertSlopeWarningThreshold(SlopeWarningThreshold slopeWarningThreshold)
    {
        slopeWarningThreshold.setCreateTime(DateUtils.getNowDate());
        return slopeWarningThresholdMapper.insertSlopeWarningThreshold(slopeWarningThreshold);
    }

    /**
     * 修改预警阈值
     * 
     * @param slopeWarningThreshold 预警阈值
     * @return 结果
     */
    @Override
    public int updateSlopeWarningThreshold(SlopeWarningThreshold slopeWarningThreshold)
    {
        slopeWarningThreshold.setUpdateTime(DateUtils.getNowDate());
        return slopeWarningThresholdMapper.updateSlopeWarningThreshold(slopeWarningThreshold);
    }

    /**
     * 批量删除预警阈值
     * 
     * @param ids 需要删除的预警阈值主键
     * @return 结果
     */
    @Override
    public int deleteSlopeWarningThresholdByIds(Long[] ids)
    {
        return slopeWarningThresholdMapper.deleteSlopeWarningThresholdByIds(ids);
    }

    /**
     * 删除预警阈值信息
     * 
     * @param id 预警阈值主键
     * @return 结果
     */
    @Override
    public int deleteSlopeWarningThresholdById(Long id)
    {
        return slopeWarningThresholdMapper.deleteSlopeWarningThresholdById(id);
    }
}
